This invention is in the technical field of processing image data by using a computer and in particular for detecting defects in a target object being inspected by inspecting its contour where it should be smooth and have no protrusions or indentations.
According to a conventional method of detecting defects in the contour of a target object, an image area corresponding to the target object is initially extracted by a binary (dark-light or black-white) method and pixels forming a boundary line (contour line) between a white pixel area and a black pixel area are sequentially traced while comparing with the other pixels in the neighborhood. If the pattern of these mutually connected pixels forming a contour line is different from the intended contour pattern of the target object, it is determined that there is a defect.
Japanese Patent Publication Tokkai 11-132743 disclosed a technology of observing one of the pixels P1 forming a contour line when the intended contour pattern is smooth, selecting pixels P2 and P3 which are separated in mutually opposite directions by a same number of pixels from P1 and detecting a defect if the angle made between line segment P1-P2 and line segment P1-P3 is greater than a specified value. The pixel to be observed is one on the contour line and the neighboring pixels are selected one after another.
Since errors associated with quantization do occur, patterns extracted from a binary image include small indentations and protrusions with the size of one pixel or several pixels in most situations even if the contour of the target object has no defects. It is therefore extremely difficult to detect a defect of such a small size by a method based on the connected pattern of the pixels which form a contour. In fact, defects which are smaller than a few pixels cannot be detected by the technology of Japanese Patent Publication Tokkai 11-132743, as can be understood because two pixels mutually separated by more than several pixels are selected according to this technology and treat the line segment connecting these two pixels as the smallest unit of the contour line. In the case of a defect on a gently curving line or a relatively wide defect with a smaller depth or height, furthermore, the angle between the line segments tends to remain large no matter how the interval between the pixels to be selected is set. Thus, it is difficult to detect a defect with high sensitivity in such a situation. Moreover, the process of selecting two pixels from an initially selected pixel on the contour line separated by a specified number of pixels and determining line segments connecting them and the angle between them must be repeated sequentially along the contour line. The calculations are cumbersome and frustrate the effort to speed up the process.